package graduation;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import javax.annotation.Resource;

import org.apache.log4j.Logger;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;


import com.dx.pojo.Account;
import com.dx.pojo.AccountCustom;
import com.dx.pojo.FindingDetail;
import com.dx.pojo.ItemsCategory;
import com.dx.pojo.LocPicking;
import com.dx.pojo.LosingInfo;
import com.dx.pojo.Title;
import com.dx.pojo.UserDetail;
import com.dx.pojo.pickItemInfo;
import com.dx.service.AccountService;
import com.dx.service.ItemsService;
import com.dx.service.LocationService;
import com.dx.service.TitleService;

@RunWith(SpringJUnit4ClassRunner.class)		//表示继承了SpringJUnit4ClassRunner类
@ContextConfiguration(locations = {"classpath:spring-mybatis.xml"})
public class testmybatis {
	
	private static Logger logger = Logger.getLogger(testmybatis.class);
//	private ApplicationContext ac = null;
	@Resource
	private AccountService accountService ;
	@Resource 
	private ItemsService itemsService;
	@Resource
	private LocationService locationService;
	 @Resource
	 private TitleService titleService;



	@Test
	public void test1() {
//		Account account=new Account();
//		account.setPasword("1");
//		account.setUserId("1");
//		int i=accountService.loginbyadmin(account);
//		// System.out.println(user.getUserName());
//		// logger.info("值："+user.getUserName());
//		logger.info(i);
		
//		AccountCustom accountCustom=new AccountCustom();
//		Account account=new Account();
//		accountCustom.setAccount(account);
//		accountCustom.getAccount().setPasword("1");
//		accountCustom.getAccount().setUserId("1");
//		accountCustom.setNewpwd("2");
//		int i=accountService.updatepwd(accountCustom);
//		logger.info(i);
//		List<LocPicking> list=new ArrayList();
//		list=locationService.queryallloc();
//		Iterator l=list.iterator();
//		while(l.hasNext()){
//			LocPicking i=(LocPicking) l.next();
//			System.out.println(i.getLocname());
//		}
//		UserDetail user=new UserDetail();
//		user.setUserId("1");
//		int i=accountService.insertuser(user);
//		logger.info(i);
		
//		Account account=new Account();
//		account.setUserId("2");
//		account.setPasword("2");
//		account.setRoleid("2");
////		accountService.insertaccount(account);
//		LosingInfo losinginfo=new LosingInfo();
//		losinginfo.setPageindex(0);
//		List<LosingInfo> list=itemsService.querylosinginfo(losinginfo);
//		
//		System.out.println(list.get(0).getCategoryID());
//		   String picid="00f72b8a59bd4b3799420d8863fda2b4";
//		   pickItemInfo pickitem=itemsService.selectdetailpicking(picid);
//		   System.out.println(pickitem);
//		Title title=new Title();
//		title.setContent("1");
//		title.setPublishingTime("1");
//		int n=titleService.inserttitle(title);
		 FindingDetail findingDetail=new FindingDetail();
		 int n=itemsService.countquerybyfinding(findingDetail);
		logger.info(n);
//		   int id=pickitem.getLocid();
//		   pickitem.setLocationaddress(locationService.quertlocname(id));
		   
	    
	}

}
